//
//  OrderDB.m
//  Order
//
//  Created by funny on 12-3-21.
//  Copyright 2012 __MyCompanyName__. All rights reserved.
//

#import "OrderDB.h"


@implementation OrderDB

@synthesize name, packagePrice, singlePrice;
@synthesize packageCount, singleCount;

- (id)initWithName:(NSString *)newName andPackagePrice:(float)newPackagePrice andSinglePrice:(float)newSinglePrice{
	
    self = [super init];
    if (self) {
        // Custom initialization.
		
		name = [newName copy];
		
		packagePrice = newPackagePrice;
		singlePrice = newSinglePrice;
		
		packageCount = 0;
		singleCount = 0;
    }
    return self;
}

+ (OrderDB *)orderDBWithName:(NSString *)newName andPackagePrice:(float)newPackagePrice andSinglePrice:(float)newSinglePrice{
	OrderDB *newOrderDB = [[[OrderDB alloc] initWithName:newName andPackagePrice:newPackagePrice andSinglePrice:newSinglePrice] autorelease];
	
	return newOrderDB;
}

- (float)calculateTotalPrice{
	return (packagePrice * packageCount + singlePrice * singleCount);
}

- (void)resetCount{
	packageCount = 0;
	singleCount = 0;
}

- (void)dealloc {
	[name release];
	
    [super dealloc];
}

@end
